<template>
	<view class="">
		<view class="shenbao">
			<view class="shenbao_title">
				活动编辑
			</view>
			<view class="shenbao_flex">
				<view class="">
					姓名：
				</view>
				<view class="">
					<input class="shenbao_flex_right" v-model="form.name"  placeholder="请输入姓名" type="text" value="" />
				</view>
			</view>
			<view class="shenbao_flex">
				<view class="">
					电话：
				</view>
				<view class="">
					<input class="shenbao_flex_right" v-model="form.mobile"  placeholder="请输入电话" type="text" value="" />
				</view>
			</view>
			<!-- <view class="shenbao_flex">
				<view class="">
					所属门店：
				</view>
				<view class="">
					<input class="shenbao_flex_right" v-model=""  placeholder="请输入所属门店名称" type="text" value="" />
				</view>
			</view> -->
			<view class="shenbao_flex">
				<view class="">
					活动时间：
				</view>
				<view class="" style="display: flex;">
					<!-- style="width: 377rpx;" -->
					<input class="shenbao_flex_right" v-model="form.activitytime" :disabled="false"  placeholder="请选择活动时间" type="text" value="" />
					<!-- <image style="width: 23rpx;height: 29rpx;" src="../../static/pages/index/right.png" mode=""></image> -->
				</view>
			</view>
			<view class="shenbao_flex">
				<view class="">
					活动地址：
				</view>
				<view class="">
					<input class="shenbao_flex_right" v-model="form.address"  placeholder="请输入活动区域" type="text" value="" />
				</view>
			</view>
			<view class="button_bottom" @click="onButton">
				确定提交
			</view>
		</view>
		
	</view>
</template>

<script>
	import {declaration,examineDetails} from '@/request/api.js'
	export default {
		data() {
			return {
				form:{
					name:'',
					mobile:'',
					distributor_id:'',
					region_id:'',
					store_id:'',
					activity_id:'',
					activitytime:'',
					address:'',
					id:'',
				}
			};
		},
		onLoad(option) {
			console.log(this.form.id,"this.form.id");
			this.form.activity_id = option.id
			this.form.id = option.sid
			this.onlodeList()
			this.OnListOne()
		},
		onShow() {
			
		},
		methods: {
			OnListOne(){
				examineDetails({
					id:this.form.id,
				}).then(res => {
					console.log(res);
					this.form = res.data
					uni.showToast({
						title: res.msg,
						icon: "none"
					})
				})
			},
			onlodeList(){
				this.form.distributor_id = uni.getStorageSync("login").id
				this.form.region_id = uni.getStorageSync("login").regional_id
				this.form.store_id = uni.getStorageSync("login").store
				
			},
			onButton(){
				if(this.form.name==''||this.form.mobile==''||this.form.activitytime==''||this.form.address==''){
					uni.showToast({
						title:"请填写完整信息",
						icon:"none"
					})
					return
				}
				declaration(this.form).then(res => {
					console.log(this.form,"=====");
					uni.showToast({
						title: res.msg,
						icon: "none"
					})
					if(res.code == 1){
						setTimeout(()=>{
							uni.reLaunch({
								url:"/pages/DLR/activity/activity"
							})
						},2000)
					}
				})
			}
		},
		
	}
</script>

<style>
	.shenbao{
		width: 670rpx;
		background: #FFFFFF;
		box-shadow: 0rpx 0rpx 14rpx 0rpx rgba(211, 213, 220, 0.4);
		border-radius: 32rpx;
		margin: 0 auto;
		margin-top: 30rpx !important;
		padding: 25rpx 25rpx 80rpx 25rpx;
	}
	.shenbao_title{
		font-size: 38rpx;
		font-family: PingFang SC;
		font-weight: 500;
		color: #313233;
		width: 100%;
		text-align: center;
		margin-bottom: 30rpx;
	}
	.shenbao_flex{
		display: flex;
		font-size: 36rpx;
		align-items: center;
		height: 90rpx;
		justify-content: space-between;
		border-bottom: 1rpx solid rgb(232,232,235);
		margin-bottom: 12rpx;
	}
	.shenbao_flex_right{
		width: 400rpx;
		font-size: 26rpx;
	}
	.button_bottom{
		width: 460rpx;
		height: 80rpx;
		background: #1855F6;
		border-radius: 40rpx;
		text-align: center;
		line-height: 80rpx;
		margin: 0 auto;
		margin-top: 200rpx;
		color: #FFFFFF;
		font-size: 30rpx;
		font-family: PingFang SC;

	}
</style>
